package org.example.design.command.test1;

import java.util.ArrayList;
import java.util.List;

/**
 * @author huangshen
 * @version 0
 * @description Broker
 * @since 2022/2/14 11:27
 */
public class Broker {
    private final List<Order> orderList = new ArrayList<>();

    public void takeOrder(Order order){
        orderList.add(order);
    }

    public void placeOrders(){
        for (Order order : orderList) {
            order.execute();
        }
        orderList.clear();
    }
}
